<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['算法管理','设备传感器状态']" icon="fa fa-subscript" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>设备传感器状态</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn" style="width: calc(100% - 300px);">
								<sa-company-tree-car companyTreeId="companyTree" (companySelected)="companySelected($event)"></sa-company-tree-car>
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">传感器状态</span>
									<select name="" class="top_module_select" [(ngModel)]="sensorStatus">
										<option value="">全部</option>
										<option value="0">无损坏</option>
										<option value="1">有损坏</option>
									</select>
								</div>
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">时间类型</span>
									<select name="" class="top_module_select" [(ngModel)]="dateType">
										<option value="offlineTime" selected>离线时间</option>
										<option value="updateTime">更新时间</option>
									</select>
								</div>
								<div class="selectDate top_module">
									<table-select-date [notInit]='true' (outerTime)="getSelectTableTime($event)" ></table-select-date>
								</div>
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">排序</span>
									<select name="" class="top_module_select" [(ngModel)]="sortField">
										<option value="" selected>默认</option>
										<option value="damageNum">损坏通道数</option>
										<option value="offlineTime">离线时间</option>
										<option value="orderNum">订单数</option>
									</select>
								</div>
								<button class="btn btn-primary" (click)="table_search()">查询</button>
								<button class="btn btn-primary" (click)="exportTable()">导出</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input" placeholder="车牌号、设备ID...">
								<span class="top-search-box">
							        <button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
							    </span>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>设备编码</th>
										<th>车牌号码</th>
										<th>损坏通道</th>
										<th>线材损坏</th>
										<th>在用系数</th>
										<th>安装通道</th>
										<th>离线时间</th>
										<th>磅单数量</th>
										<th>更新时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData; let i = index" [attr.data-index]="i"  [ngClass]="{selected:activeSelected === row.id}" (dblclick)='checkAbnormal(row)'>
										<td>{{row.deviceId}}</td>
										<td>{{row.carNumber}}</td>
										<td><span class="channel-style bg-red" *ngFor="let item of row.sensorStatus;let index = index;" [style.display]="item!=1 && item!=2 && item!=3 && item!=4?'none':'inline-block'" >{{index+1}}</span></td>
										<td>
											<span *ngIf="row.lineBad != 1"></span>
											<span *ngIf="row.lineBad == 1">损坏</span>
										</td>
										<td>
											<span *ngIf='row.currentCoefT.length >0'>
												<span>[</span><span *ngFor="let lis of row.currentCoefT;let i = index;">
													<span style="font-weight: bold;">CH{{lis.index}}:</span><span>{{lis.value}}<span *ngIf="i < row.currentCoefT.length-1">,</span></span>
												</span><span>]</span>
											</span>
										</td>
										<td><span  class="channel-style bg-green" *ngFor="let item of row.sensorChannel">{{item}}</span></td>
										<td>{{row.offlineTime}}</td>
										<td>{{row.orderNum}}</td>
										<td>{{row.updateTime}}</td>
										<td>
											<button type="button" (click)="checkAbnormal(row)">查看</button>
											<button type="button" (click)="delRow(row)">刪除</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						           [rows]="pageSize"
						           [currentPage]="curPage - 1"
						           (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
	<!--折线图-->
	<div  style="background: white;border-radius: 5px;margin-top: 5px;position: relative;" [hidden]='!isChartView'>
		<button (click)="closeChart()" class="div_closeBtn"> × </button>
		<div class="widget-body no-padding" style="margin: 0;">
			<div class="page-header clearfix s_table_opreation" style="margin: 0;">
				<div class="left page-header-btn" style="padding: 5px;">
					<div class="top_module">
						<span class="module_text" style="background: none;" >异常数据折线图</span>
					</div>
					<div style="display: inline-block;">
						<div>
							<div class="selectDate top_module">
								<table-select-date [notInit]='true' [specifyId]='specifyId' [specifyTime]='specifyTime' (outerTime)="getSelectChartTime($event)" ></table-select-date>
							</div>
							<button type="button" class="btn btn-primary" (click)="drawAbnormalChart()">查看</button>
						</div>
					</div>
				</div>
			</div>
		</div>
		
		<sa-chart-bmap [height]='325' [offDatas]='true' [inputParams]='selectedRow' [isBaiduMap]='true' (outerSend)="runParent($event)" (outerIsMap)='showMapView($event)' 
			[isAuditData]='false'	[isShowModify]='false'></sa-chart-bmap>
		<div [hidden]='!isMapView'>
			<sa-bmap-chart [trackParams]='drawTrackArr' [isShowBmap]='isMapView' deviceId="deviceId"></sa-bmap-chart>
		</div>
	</div>
</div>